<?php

namespace common\validate;

class Tag extends BaseValidate
{
    // 验证规则
    protected $rule = [];

    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this;
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array');
    }

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this->append('data.name', 'require|max:128')
            ->append('data.color', 'require|max:7')
            ->append('data.type', 'in:system,review,approve,publish,custom,liber')
            ->append('data.category', 'max:128')
            ->append('data.use_scope', 'max:255');
    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data.id', 'require')
            ->append('data.name', 'max:128')
            ->append('data.type', 'in:system,review,approve,publish,custom,liber')
            ->append('data.category', 'max:128')
            ->append('data.use_scope', 'max:255');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require');
    }

    // GetList 验证场景定义
    public function sceneGetList()
    {
        return $this->append('param.use_scope', 'array')
            ->append('param.page', 'array');
    }
}
